from TurtleWorld import *
from math import *
 
world=TurtleWorld()
q=Turtle()
q.delay = 0 
#----------------------------TRIANGLES----------------------------#

def equilateral_tri(t, size=100, rotate=0):
	print "Equilateral Triangle, with Size:", size, "and Rotation:", rotate
	t.lt(rotate)
	for i in range(3):
		t.fd(size)
		t.rt(120)	
	t.rt(rotate)
def tri(t, size=100, rotate=0):
	t.lt(rotate)
	for i in range(3):
		t.fd(size)
		t.rt(120)	
	t.rt(rotate)	
#--------------------------QUADRILATERALS-------------------------#

def para(t, width=100, height=100, angle=120, rotate=0):
	print "Parallelogram, with Width:", width, "Height:", height, "Angle:", angle, "and Rotation:", rotate
	t.lt(rotate)
	for i in range(2):
		t.fd(width)
		t.rt(135)
		t.fd(height)
		t.rt(45)
	t.rt(rotate)	
def rhom(t, size=100, angle=120, rotate=0):
	print "Rhombus, with Size:", size, "Angle:", angle, "and Rotation:", rotate
	t.lt(rotate)
	for i in range(2):
		t.fd(size)
		t.rt(45)
		t.fd(size)
		t.rt(135)
	t.rt(rotate)	
def rect(t, width=100, height=100, rotate=0):
	print "Rectangle, with Width:", width, "Height:", height, "and Rotation:", rotate
	t.lt(rotate)
	for i in range(2):
		t.fd(height)
		t.rt()
		t.fd(width)
		t.rt()
	t.rt(rotate)		
def square(t, size=100, rotate=0):
	print "Sqaure, with Size:", size, "and Rotation:", rotate
	t.lt(rotate)
	for i in range(4):
		t.fd(size)
		t.rt()
	t.rt(rotate)	
def sq(t, size=100, rotate=0):
	print "Sqaure, with Size:", size, "and Rotation:", rotate
	t.lt(rotate)
	for i in range(4):
		t.fd(size)
		t.rt()
	t.rt(rotate)		
#------------------------------MOVEMENT---------------------------#

def line(t, x=100.0, y=100.0):
	print "Line to a point X:", x, "over and Y:", y, "up"
	x=float(x)
	length=sqrt(x**2+y**2)
	t.lt(degrees(atan(y/x)))
	t.fd(length)
	t.rt(degrees(atan(y/x)))
def move(t, x, y):
	print "Move without marking to a point X:", x, "over and Y:", y, "up"
 	t.pu()
	line(t, x, y)
	t.pd()
#------------------------------OTHER SHAPES------------------------#
def star(t, side=100.0, rotate=0):
	t.lt(rotate)
	for i in range(5):
		t.fd(side)
		t.rt(144.05)
	t.rt(rotate)			
def pent(t, side=100.0, rotate=0):
	t.lt(rotate)
	for i in range(5):
		t.fd(side)
		t.rt(360/5)
	t.rt(rotate)			
def cir(t, size=100.0, rotate=0):
	t.lt(rotate)
	for i in range(45):
		t.fd(size*8)
		t.lt(8)	
def sqfl(t, size=100, petals=5, rotate=0):
	t.lt(rotate)
	t.lt(135)
	for i in range(petals):
		square(t, size)
		t.rt(360.0/petals)
	t.rt(135)
	t.rt(rotate)	
def trifl(t, size=100, petals=3, rotate=0):
	t.lt(rotate)
	t.lt(45)
	for i in range(petals):
		tri(t, size)
		t.rt(360.0/petals)
	t.rt(45)
	t.rt(rotate)
def cirfl(t, size=100.0, petals=5, rotate=0):
	t.lt(rotate)
	for i in range(petals):
		cir(t, size)
		t.rt(360.0/petals)
	t.rt(rotate)		
def pntcl(t, size=100.0, rotate=0):
	t.lt(rotate)
	t.rt(72.5)
	star(t, size)
	t.lt(36)
	pent(t, 
	size/1.6)
	t.rt(140)
	cir(t, size/106.5)
	t.rt(rotate)
def pntclfl(t, size=100, petals=3, rotate=0):
	t.lt(rotate)
	for i in range(petals):
		pntcl(t, size)
		t.rt(360.0/petals)
	t.rt(rotate)		
def pntclspyrl(t, max=1000, angle=45, inc=10, rotate=0):
	t.lt(rotate)
	count = 10
	while count<=max:
		pntcl(t, count)
		count+=(inc)
		t.rt(angle)
	t.rt(rotate)		
def sqspyrl(t, max=1000, inc=10, spyrls=5, rotate=0):
	t.lt(rotate)
	count = 10
	while count<=max:
		square(t, count)
		count+=(inc)
		t.rt(360/5)	
	t.rt(rotate)		
def trispyrl(t, max=1000, angle=45, inc=10, rotate=0):
	t.lt(rotate)
	count = 10
	while count<=max:
		tri(t, count)
		count+=(inc)
		t.rt(angle)
	t.rt(rotate)		
def starspyrl(t, max=1000, angle=45, inc=10, rotate=0):
	t.lt(rotate)
	count = 10
	while count<=max:
		star(t, count)
		count+=(inc)
		t.rt(angle)
	t.rt(rotate)		
def sqflspyrl(t, max=1000, angle=45, inc=10, rotate=0):
	t.lt(rotate)
	count = 10
	while count<=max:
		sqfl(t, count)
		count+=(inc)
		t.rt(angle)
	t.rt(rotate)		
def triflspyrl(t, max=1000, angle=45, inc=10, rotate=0):
	t.lt(rotate)
	count = 10
	while count<=max:
		trifl(t, count)
		count+=(inc)
		t.rt(angle)		
def cirspyrl(t, max=1000.0, angle=45, inc=10, rotate=0):
	t.lt(rotate)
	count = 10.0
	while count<=max:
		cir(t, count/50)
		count+=(inc)
		t.rt(angle)
	t.rt(rotate)		
def suprspyrl(t, max=1000.0, angle=45, inc=10, rotate=0):
	t.lt(rotate)
	count = 10.0
	while count<=max:
		sqspyrl(t, count/50)
		count+=(inc)
		t.rt(angle)
	t.rt(rotate)		
def sqspyrl2(t, max=1000.0, angle=45, inc=10, rotate=0):
	t.lt(rotate)
	count = 10.0
	while count<=max:
		square(t, count)
		count+=(inc)
		t.rt(angle)	
	while count>=inc:
		sq(t, count)
		count-=(inc)
		t.rt(angle)
	t.rt(rotate)		
def tri2(t, side=100, rotate=0):
	t.lt(rotate)
	for i in range(100):
		t.fd(side)
		t.rt(131)
	t.rt(rotate)		
def tricir(t, size=100.0, angle=130, sides=100, rotate=0):
	t.lt(rotate)
	for i in range(sides):
		tri2(t, size)
		t.rt(angle)
	t.rt(rotate)

#------------------------------TEST-------------------------------#


wait_for_user()